package com.work.user.feign;

import com.work.entity.Result;
import com.work.user.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@FeignClient(name = "user")
public interface UserFeign {
    //多条件分页查询
    @GetMapping("/user/search")
    public Result findList(@RequestParam Map searchMap);

    @GetMapping("/user/search/{page}/{size}")
    public Result findPage(@RequestParam Map searchMap, @PathVariable("page") int page, @PathVariable("size") int size);

    //新增用户
    @PostMapping("/user/add")
    public Result add(@RequestBody User user,  @RequestParam("roleIds")Integer[] roleIds);

    //修改用户
    @PutMapping("/user/update")
    public Result update(@RequestBody User user,  @RequestParam("roleIds")Integer[] roleIds);

    //删除用户
    @DeleteMapping("/user/delete")
    public Result delete(@RequestParam Integer id);

    @GetMapping("/user/findById")
    public Result<User> findById(@RequestParam Integer id);

}
